package deployr.core;

import static java.text.MessageFormat.*;

public class Wars {

	private final FileSystem origin;
	private final FileSystem target;

	public Wars(FileSystem origin, FileSystem target) {
		this.origin = origin;
		this.target = target;
	}

	public void copyFromOriginToTarget(String appId) {
		target.copy(origin.read(warNameFor(appId)), warNameFor(appId));
	}

	private String warNameFor(String appId) {
		return format("{0}.war", appId);
	}

	public void deleteTarget(String appId) {
		target.delete(appId);
	}

}
